
<!DOCTYPE html >
<html>
<head>
    <meta name="Generator" content="ECSHOP v2.7.3" />
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>订单详情  </title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <meta name="Keywords" content="" />
    <meta name="Description" content="" />
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="/template/default/css/public.css">
    <link rel="stylesheet" href="/template/default/css/flow.css">
    <script type="text/javascript" src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="/template/default/js/ecsmart.js"></script>
    <script type="text/javascript" src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
    <style>
        .address-name {
            color: aliceblue!important;
        }
        .address-phone{
            color: aliceblue!important;
        }
        
        .order-buy .order-info .order-list-info .list-price-nums p{
            font-size: 12px;
        }
        .bottom-bar{
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
        }
        .order{
            margin-bottom: 70px;
        }
        .payPoints{

            width: 100px;
            height: 20px;
            outline: none;
            border: 1px solid #eee;
            border-radius: 4px;
            margin-left: 5px;
        }
        .payDeposit{

            width: 100px;
            height: 20px;
            outline: none;
            border: 1px solid #eee;
            border-radius: 4px;
            margin-left: 5px;
        }
    </style>
</head>
<body style="background: rgb(235, 236, 237);">
<div class="tab_nav">
    <div class="header">
        <div class="h-left">
            <a class="sb-back" href="javascript:history.back(-1)" title="返回"><img
                    src="/template/default/images/arrow_left_white.png"/></a>
        </div>
        <div class="h-mid">确认订单</div>
    </div>
</div>

<div class="screen-wrap fullscreen login">
    <form action="/b/order/save" method="post" name="theForm" id="theForm" onsubmit=" return check()">
        <input type="hidden" name="shopId" value="${shopId!}"/>
        <input type="hidden" name="isMinNi"id="isMinNi" />
        <input type="hidden" name="totalQuantity" value="${totalQuantity!}">
        <section class="content" style="min-height: 294px;">
            <div class="wrap">
                <div class="active" style="min-height: 294px;">
                    <div class="content-buy">
                        <div class="wrap order-buy">
                            <%if(isEmpty(receiverId)){%>
                                <% var defaultReceiver=loginMember.defaultReceiver; %>
                                <%if(isNotEmpty(defaultReceiver)){%>
                                    <a href="/b/receiver/list?returnUrl=/b/order/info">
                                        <section class="address " >
                                            <input type="hidden" name="receiver.id" value="${defaultReceiver.id}"/>
                                            <div class="address-info" >
                                                收货人:
                                                <p class="address-name"  style="color: aliceblue">${defaultReceiver.name!}</p>
                                                <p class="address-phone" style="color: aliceblue">${defaultReceiver.mobile!}</p>
                                            </div>
                                            <div class="address-details" style="color: aliceblue">${defaultReceiver.address!}</div>
                                        </section>
                                    </a>
                                <%}%>
                            <%}else{%>
                               <a href="/b/receiver/list?returnUrl=/b/order/info">
                                    <section class="address " >
                                        <input type="hidden" name="receiver.id" value="${selecttReceiver.id!}"/>
                                        <div class="address-info" >
                                            收货人:
                                            <p class="address-name">${selecttReceiver.name!}</p>
                                            <p class="address-phone">${selecttReceiver.mobile!}</p>
                                        </div>
                                        <div class="address-details">${selecttReceiver.address!}</div>
                                    </section>
                                </a>
                            <%}%>
                            <input type="button" class="c-order-btn  J_submit" onclick="location.href='/b/receiver/list?shopId=${shopId!}&productId=${productId!}&returnUrl=/b/order/info'" value="管理收货地址" style="height: 35px;line-height: 35px;margin-top: 12px;margin-left: 12px">
                            <section class="order " id="order4">
                                <section class="order-info">
                                    <div class="order-list">
                                        <div class="orderInfo " >
                                            <h4 class="seller-name">
                                                <img src="/template/default/images/dingdan.png" width="28"> 订单详情
                                                 <a class="modify" href="/b/cartItem/list?shopId=${shopId!}">修改</a>
                                            </h4>
                                        </div>
                                        <ul class="order-list-info">
                                        <%for(list in cartItemList){%>
                                            <%
                                                var product=list.product;
                                            %>
                                            <li class="item " id="item2">
                                                <div class="itemPay list-price-nums" id="itemPay17">
                                                    <p class="price">￥${product.price}</p>
                                                    <p class="nums">x${list.quantity}</p>
                                                </div>
                                                <div class="itemInfo list-info" id="itemInfo12">
                                                    <div class="list-img">
                                                        <a href="/b/product/detailWap?id=${product.id}&shopId=${product.shopId!}">
                                                            <img src="${product.productImageList[0].sourceProductImagePath!}"></a>
                                                    </div>
                                                    <div class="list-cont">
                                                        <h5 class="goods-title">${product.name}</h5>
                                                        <span style="color: #999;">${product.specificationValues}</span>
                                                        <p class="godds-specification"></p>
                                                    </div>
                                                </div>
                                            </li>
                                        <%}%>

                                        </ul>
                                        <div class="content ptop0">

                                            <div class="panel panel-default info-box">
                                                <div class="panel-body">
                                                    <div class="title" id="zhifutitle" style="border-bottom:1px solid #eeeeee;">
                                                        <span class="i-icon-arrow-down i-icon-arrow-up" id="zhifuip"></span>
                                                        <span class="text ">支付方式</span>
                                                        <!--<a href="javascript:void(0)" title="修改商品列表" class="link">必选</a> --><em class="qxz" id="emzhifu">请选择支付方式</em>
                                                    </div>
                                                    <ul class="nav nav-list-sidenav" id="zhifu68" style="display:block;">
                                                        <%if(browserType! =="weixinBrowser"){%>
                                                            <%for(list in allPaymentConfig){%>
                                                                <%if(list.paymentConfigTypeValue!="alipay" && list.paymentConfigTypeValue!="deposit" && list.paymentConfigTypeValue!="point"){%>
                                                                <li>
                                                                    <input type="radio" name="paymentConfig_id" id="${list.id}" value="${list.id}"  isCod="0" class="pay-radio" style="margin-top:6px"/>
                                                                    <label class="label_ap" for="${list.id}">
                                                                        <i></i>
                                                                        <span>${list.name}</span>
                                                                    </label><!--  ${list.paymentFee,orderUnitCurrencyFormat} -->
                                                                </li>
                                                                <%}%>
                                                            <%}%>
                                                        <%}else{%>
                                                            <%for(list in allPaymentConfig){%>
                                                                <%if(list.paymentConfigTypeValue!="weixin" && list.paymentConfigTypeValue!="deposit" && list.paymentConfigTypeValue!="point"){%>
                                                                    <li><input type="radio" name="paymentConfig_id" id="${list.id}" value="${list.id}"  isCod="0" class="pay-radio" style="margin-top:6px"/>
                                                                        <label class="label_ap" for="${list.id}" >
                                                                            <i></i>
                                                                            <span>${list.name}</span>
                                                                        </label><!-- ${list.paymentFee,orderUnitCurrencyFormat} -->
                                                                    </li>
                                                                <%}%>
                                                            <%}%>
                                                        <%}%>
                                                        <%for(list in allPaymentConfig){%>
                                                            <%if(list.paymentConfigTypeValue=="deposit" && isNotEmpty(userBalance) && userBalance.balance > 0){%>
                                                                <li id="pay-deposit-options"><input type="checkbox" name="paymentConfig_id" id="${list.id}" value="${list.id}"  isCod="0" class="pay-radio" style="margin-top:6px"/>
                                                                    <label class="label_checkbox" for="${list.id}" >
                                                                        <i></i>
                                                                        <span>${list.name}(当前余额：${userBalance.balance})</span>
                                                                    </label><!-- ${list.paymentFee,orderUnitCurrencyFormat} -->
                                                                    <br>
                                                                    <div id="pay-deposit-input" style="display:none;">
                                                                        使用余额<input type="number" step="0.01" min="0" name="payDeposit" style="display:inline-block" class="payDeposit">
                                                                    </div>
                                                                </li>
                                                            <%}else if (list.paymentConfigTypeValue=="point" && isNotEmpty(userBalance) && userBalance.point > 0){%>
                                                                <li id="pay-points-options"><input type="checkbox" name="paymentConfig_id" id="${list.id}" value="${list.id}"  isCod="0" class="pay-radio" style="margin-top:6px"/>
                                                                    <label class="label_checkbox" for="${list.id}" >
                                                                        <i></i>
                                                                        <span>${list.name}(当前积分：${userBalance.point})</span>
                                                                    </label>
                                                                    <br>
                                                                    <div id="pay-points-input" style="display:none;">
                                                                        使用积分<input type="number" step="1" min="0" name="payPoints" style="display:inline-block" class="payPoints">（100积分可以抵扣1元）
                                                                        <br>
                                                                        <p id="pay-points-detail"></p>
                                                                    </div>
                                                                </li>
                                                            <%}%>
                                                        <%}%>
                                                    </ul>
                                                </div>
                                            </div>
                                            <div class="panel panel-default info-box">
                                                <div class="panel-body">
                                                    <div class="" id="fuyantitle2" style="border-bottom:1px solid #eeeeee;display: flex;align-items: center;justify-content: space-between;padding: 10px 5px ">
                                                        <span class="text">运费</span>
                                                        <span style="font-size: 18px;color: red;" class="deliveryFee">+￥0.00</span>
                                                        <input type="hidden" class="hiddenDeliveryFee" value="0.00">
                                                    </div>
                                                </div>
                                            </div>

                                            <!--<div class="panel panel-default info-box">
                                                <div class="panel-body">
                                                    <div class="title" id="fuyantitle" style="border-bottom:1px solid #eeeeee;">
                                                        <span class="i-icon-arrow-down" id="fuyanip"></span>
                                                        <span class="text">订单附言</span>
                                                    </div>
                                                    <ul class="nav nav-list-sidenav" id="fuyan68" style="display: block;border: none!important;">
                                                        <li>
                                                            <textarea name="memo" class="voucher-num" value=""  autocomplete="off" id="postscript"></textarea>
                                                        </li>
                                                    </ul>

                                                </div>

                                            </div>-->

                                        </div>
                                    </div>
                                </section>
                            </section>
                            <section class="bottom-bar">
                                <div class="total-price">
                                    <div>
                                        <p class="submitOrder "><input type="submit" class="c-order-btn  J_submit" value="确认"/> </p>
                                        <p class="realPay">合计：<strong class="price" id="ECS_ORDERTOTAL_T">￥${productTotalPrice}元</strong> </p>
                                    </div>
                                </div>
                            </section>

                        </div>

                    </div>
                </div>

            </div>

        </section>
    </form>
</div>

</body>
<script type="text/javascript">
    $(function () {
        var isMinNi = window.__wxjs_environment === 'miniprogram';
        $('#isMinNi').val(isMinNi);
       var receiverId=$('input[name="receiver.id"]').val();
       if(receiverId){
           $.ajax({
               url: "getAllDeliverFee",
               type: 'GET',
               dataType:'json',
               data:{
                   "receiverId":receiverId,
               },
               success: function(data){
                   if(data.state=='ok'){
                       var productTotalPrice=parseFloat("${productTotalPrice}");
                       var deliveryFee=parseFloat(data.deliveryFee);
                       $(".deliveryFee").html("+￥"+data.deliveryFee)//运费
                       $("#ECS_ORDERTOTAL_T").html("￥"+(productTotalPrice+deliveryFee)+"元");
                       $(".hiddenDeliveryFee").val(deliveryFee);
                       //var firstProvinceId = $('#sel-provance').find("option:selected").next().val();
                   }
               }
           });
       }


        //余额或者积分抵扣动态改变
        var totalMoney = "${productTotalPrice}";
        var payMoney = totalMoney;
        var payPoints = 0;
        var payDeposit = 0;
        var userPoints = ${userBalance.point!0};
        var userBalance = ${userBalance.balance!0};

        $("#pay-points-options input[type=checkbox]").change(function(){
            var ifChecked = $(this).is(":checked");
            if (ifChecked){
                $("#pay-points-input").show();
            } else {
                $("#pay-points-input").hide();
            }
        });
        $("#pay-deposit-options input[type=checkbox]").change(function(){
            var ifChecked = $(this).is(":checked");
            if (ifChecked){
                $("#pay-deposit-input").show();
            } else {
                $("#pay-deposit-input").hide();
            }
        });
        $("#pay-points-options input[name=payPoints]").on("input", function(){
            setPayPoints(toInt($(this).val()))
        });
        $("#pay-deposit-options input[name=payDeposit]").on("input", function(){
            setPayDeposit(toDecimal($(this).val()));
        });

        function setPayDeposit(deposit){
            var hiddenDeliveryFee=parseFloat($(".hiddenDeliveryFee").val());//运费
            if (deposit > userBalance){
                deposit = userBalance;
            }
            var maxMoney = toDecimal(totalMoney - payPoints / 100);
            if (deposit > maxMoney){
                deposit = maxMoney;
            }
            payDeposit = toDecimal(deposit);
            payMoney = toDecimal(totalMoney - payPoints / 100 - payDeposit);
            $("input[name=payDeposit]").val(payDeposit);
            $("#ECS_ORDERTOTAL_T").text(payMoney+hiddenDeliveryFee);
        }

        function setPayPoints(points){
            var hiddenDeliveryFee=parseFloat($(".hiddenDeliveryFee").val());//运费
            if (points > userPoints){
                points = userPoints;
            }
            var maxPoints = (totalMoney - payDeposit) * 100;
            if (points > maxPoints){
                points = maxPoints;
            }
            payPoints = toInt(points);
            payMoney = toDecimal(totalMoney - payDeposit - points / 100);
            $("input[name=payPoints]").val(payPoints);
            $("#ECS_ORDERTOTAL_T").text(payMoney+hiddenDeliveryFee);
            $("#pay-points-detail").html("使用" + toInt(points) + "积分抵扣" + toDecimal(points / 100) + "现金");
        }
        //余额或者积分抵扣动态改变
    });
    $(function () {

    });

    function toInt(x){
        var i = parseInt(x);
        if (isNaN(i)) {
            return 0;
        }
        return i;
    }

    //保留两位小数
    //功能：将浮点数四舍五入，取小数点后2位
    function toDecimal(x) {
        var f = parseFloat(x);
        if (isNaN(f)) {
            return 0;
        }
        f = Math.round(x*100)/100;
        return f;
    }

    function check(){
        var receiver=$('input[name="receiver.id"]').val();
        //var deliveryType_id=$('input:radio[name="deliveryType_id"]:checked').val();//配送方式
        var paymentConfig_id=$('input:radio[name="paymentConfig_id"]:checked').val();//支付方式
        if(!receiver){
            layer.msg("收货信息不能为空!");
            return false;
        }
        if(!paymentConfig_id){
            layer.msg("支付方式不能为空!");
            return false;
        }
    }
</script>
</html>